/*
 * @Author: czy
 * @Date: 2021-05-01 11:15:40
 * @LastEditTime: 2021-05-02 14:33:43
 */
#ifndef __MYTIME_H_
#define __MYTIME_H_

#define TIME_ZONE 8

typedef long long time_t;
typedef struct
{
    int tm_sec;  /* Seconds.	    [0-60] (1 leap second) */
    int tm_min;  /* Minutes.	    [0-59] */
    int tm_hour; /* Hours.	        [0-23] */
    int tm_mday; /* Day.		    [1-31] */
    int tm_mon;  /* Month.	        [0-11] */
    int tm_year; /* Year	        - 1900.  */
    int tm_wday; /* Day of week.    [0-6] */
    int tm_msec; /* Milliseconds.   [0-999] */
} tm;
enum DAY
{
    SUN,
    MON,
    TUE,
    WED,
    THU,
    FRI,
    SAT
};
enum MONTH
{
    Jan,
    Feb,
    Mar,
    Apr,
    May,
    Jun,
    Jul,
    Aug,
    Sept,
    Oct,
    Nov,
    Dec
};

int leap_year(int year);
int month_day(int month, int year);
void update_time(void);
void init_time(void);
void setTime(int h, int m, int s);
time_t date_difference(tm date1, tm date2);
time_t mktime(tm datetime);
time_t time(void);
tm base_date(void);
tm gmtime(void);
void sleep(unsigned secs);
char *mystrftime(char *str, char *fmt, tm datetime);
void timer(void (*func)(void), int interval);
void setTimeout(void (*func)(void), int interval);

#endif